/**
 * @Time    : 2022/03/09 15:19
 * @Author  : WanRongJia
 * @License : Software business license
 * @Site    : www.linshensjl.top
 * @File    : searchUser.js
 * @Software: Rich Web Platform
 * @Function: 注册用户
 * @Version : 1.0
 **/
const { matchedData } = require('express-validator')
const { buildResponse } = require('../../utils/buildResponse')
const { findUserByPage } = require("./helpers/findUserByPage")
const userList = async function (req, res) {
    try {
        req = matchedData(req)
        let query = {
            page: req.page || 1,
            size: req.size || 10,
            keywords: req.keywords
        }
        let userList = await findUserByPage(query)
        res.json(buildResponse(userList, '查询成功', true))
    } catch (e) {
        res.json(e)
    }
}

module.exports = { userList }